<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>新版本立方体</title>
    <style>
        .box{
            width: 200px;
            height: 200px;
            margin: 300px auto;
            perspective: 500px;
        }
        ul{
            transform-style: preserve-3d;
            position: relative;
            transition: all 10s;
        }
        li{
            transition: all 2s;
            width: 200px;
            height: 200px;
            position: absolute;
            top: 0;
            left: 0;
            list-style: none;
            text-align: center;
            line-height: 200px;
            color: aqua;
            font-size: 50px;
        }
        li:nth-child(1){
            transform: translateZ(100px);
            background: rgba(48,123,85,0.5);
        }
        li:nth-child(2){
            transform: rotateX(180deg) translateZ(100px);
            background: rgba(148,223,85,0.5);
        }
        li:nth-child(3){
            transform: rotateY(90deg) translateZ(100px);
            background: rgba(248,12,8,0.5);
        }
        li:nth-child(4){
            transform: rotateY(-90deg) translateZ(100px);
            background: rgba(48,4,185,0.5);
        }
        li:nth-child(5){
            transform: rotateX(90deg) translateZ(100px);
            background: rgba(4,123,185,0.5);
        }
        li:nth-child(6){
            transform: rotateX(-90deg) translateZ(100px);
            background: rgba(4,13,5,0.5);
        }
        ul:hover{
            transform: rotateX(360deg) rotateY(360deg);
        }
        ul:hover li:nth-child(1){
            transform: translateZ(100px);
            background: rgba(48,123,85,0.5);
        }
        ul:hover li:nth-child(2){
            transform: rotateX(180deg) translateZ(200px);
            background: rgba(48,123,85,0.5);
        }
        ul:hover li:nth-child(3){
            transform:  rotateY(90deg) translateZ(200px);
            background: rgba(48,123,85,0.5);
        }
        ul:hover li:nth-child(4){
            transform:  rotateY(-90deg) translateZ(200px);
            background: rgba(48,123,85,0.5);
        }
        ul:hover li:nth-child(5){
            transform: rotateX(90deg) translateZ(200px);
            background: rgba(48,123,85,0.5);
        }
        ul:hover li:nth-child(6){
            transform: rotateX(-90deg) translateZ(200px);
            background: rgba(48,123,85,0.5);
        }
    </style>
</head>
<body>
    <div class="box">
        <ul>
            <li>前</li>
            <li>后</li>
            <li>左</li>
            <li>右</li>
            <li>上</li>
            <li>下</li>
        </ul>
    </div>
    <button>点击释放效果</button>
    <script>
        var ul = document.getElementsByTagName("ul");
        var li = document.getElementsByTagName("li");
        var btn = document.getElementsByTagName("button");
        btn.onclick = function(){
            li.style.width = 300+"px";
        }
    </script>
</body>
</html>
